package logger

import (
	"gitee.com/lxx_23/lxx-go-fun/middleware"
	"gitee.com/lxx_23/lxx-go-fun/utils"
	"github.com/gin-gonic/gin"
)

// Log http 洋葱模型 log
type Log struct{}

func (l *Log) RequestLogInfo(ctx *gin.Context, logInfo middleware.GinRequestLogInfo) {
	b, _ := utils.Marshal(logInfo)
	Logger.Info(string(b))
}

func (l *Log) ResponseLogInfo(ctx *gin.Context, logInfo middleware.GinResponseLogInfo) {
	b, _ := utils.Marshal(logInfo)
	Logger.Info(string(b))
}

func (l *Log) RuntimePanicErrorLogInfo(ctx *gin.Context, logInfo middleware.GinRuntimePanicErrorLogInfo) {
	b, _ := utils.Marshal(logInfo)
	Logger.Error(string(b))
}
